public member class
<vector>

std::vector<bool>::reference

class reference;
Reference type
This embedded class is the type returned by members of non-const vector<bool> when directly accessing its elements. It accesses individual bits with an interface that emulates a reference to a bool.

Its prototype is:
1
2
3
4
5
6
7
8
9
10
class vector<bool>::reference {
  friend class vector;
  reference();                                          // no public constructor
public:
  ~reference();
  operator bool () const;                               // convert to bool
  reference& operator= (const bool x);                  // assign from bool
  reference& operator= (const reference& x);            // assign from bit
  void flip();                                          // flip bit value.
};

1
2
3
4
5
6
7
8
9
10
class vector<bool>::reference {
  friend class vector;
  reference() noexcept;                                 // no public constructor
public:
  ~reference();
  operator bool () const noexcept;                      // convert to bool
  reference& operator= (const bool x) noexcept;         // assign from bool
  reference& operator= (const reference& x) noexcept;   // assign from bit
  void flip();                                          // flip bit value.
};